#include <stdio.h>
#include <stdlib.h>
#include <string.h>


char * longestPalindrome(char * s)
{
	int i, start = 0;
	int left, right;
	int len = 0;
	int N = strlen(s);

	/* 奇数回文串 */
	for (i = 0; i < N; i++)
	{
		left = i - 1;
		right = i + 1;

		while (left >= 0 && right < N && s[left] == s[right])
		{
			left--;
			right++;
		}
		if (right - left - 1 > len)
		{
			start = left + 1;
			len = right - left - 1;
		}

	}
	
	/* 偶数回文串 */

	for (i = 0; i < N; i++)
	{
		left = i;
		right = i + 1;

		while (left >= 0 && right < N && s[left] == s[right])
		{
			left--;
			right++;
		}
		if (right - left - 1 > len)
		{
			start = left + 1;
			len = right - left - 1;
		}

	}
	
	s[start+len] = '\0';
	return start + s;
}


int main()
{
	char *ret = NULL;
	char arr[1000] = {0};
	fgets(arr,1000,stdin);
	ret = longestPalindrome(arr);
	if (ret)
		puts(ret);

	exit(0);
}
